unit uBaixaContasPagar;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.Buttons, Vcl.ExtCtrls,
  Data.DB, Vcl.DBCtrls, Vcl.Mask, JvExMask, JvToolEdit, JvDBControls;

type
  TfrmBaixaContasPagar = class(TForm)
    Panel2: TPanel;
    btnOk: TBitBtn;
    btnCancelar: TBitBtn;
    Label9: TLabel;
    DBLookupComboBox1: TDBLookupComboBox;
    dsTblfdp: TDataSource;
    dsTbltap: TDataSource;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    DBEdit3: TDBEdit;
    Label4: TLabel;
    DBEdit4: TDBEdit;
    Label5: TLabel;
    DBEdit5: TDBEdit;
    Label6: TLabel;
    DBEdit6: TDBEdit;
    Label7: TLabel;
    DBEdit7: TDBEdit;
    dsTblban: TDataSource;
    DBLookupComboBox2: TDBLookupComboBox;
    JvDBDateEdit1: TJvDBDateEdit;
    Label8: TLabel;
    DBEdit1: TDBEdit;
    procedure FormKeyPress(Sender: TObject; var Key: Char);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure btnOkClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  frmBaixaContasPagar: TfrmBaixaContasPagar;

implementation

{$R *.dfm}

uses uConexao, uDadosContasPagar;

procedure TfrmBaixaContasPagar.btnOkClick(Sender: TObject);
begin
  try
    dmDadosContasPagar.SalvarBaixaLancamento;
  except
    on E: Exception do
    begin
      MessageDlg(e.Message, mtError,[mbOK],0);
      ModalResult := mrNone;
    end;
  end;
end;

procedure TfrmBaixaContasPagar.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
  dmDadosContasPagar.CalcelarLancamento;
end;

procedure TfrmBaixaContasPagar.FormKeyPress(Sender: TObject; var Key: Char);
begin
  if key = #13 Then
  begin
    key := #0;
    Perform(Wm_NextDlgCtl,0,0);
  end;
end;

end.
